package com.itrencai.d13_thread.threadpoor;

import java.util.concurrent.*;

//自定义一个线程池对象并测试其特性
//使用Executors的工具方法直接得到一个线程池对象
public class ThreadPoorDemo3 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
       //1.创建固定线程数量的线程池
        ExecutorService pool=Executors.newFixedThreadPool(3);
        pool.execute(new MyRunnable());
        pool.execute(new MyRunnable());
        pool.execute(new MyRunnable());
        pool.execute(new MyRunnable());//已经没有多余线程，不再服务了


    }
}
